package com.glodon.paas.account.dao;

import com.glodon.paas.account.dao.domain.OAuthTokenEntity;


/**
 * interface for OAuth token store
 * 
 * @author guojf
 * 
 */
public interface OAuthTokenDao extends DBDao<OAuthTokenEntity, String>{

	/**
	 * read a token from the persistence
	 * 
	 * @param tokenValue
	 * @return
	 */
	OAuthTokenEntity readToken(String tokenValue);

	/**
	 * save a token into the persistence
	 * 
	 * @param token
	 */
	void saveToken(OAuthTokenEntity token);

	/**
	 * remove a token from the persistence
	 * 
	 * @param tokenValue
	 * @return
	 */
	OAuthTokenEntity removeToken(String tokenValue);
	
	/**
	 * remove all tokens that is authorized to the specified consumer by the specified user
	 * @param consumerKey
	 * @param authorizerId
	 */
	void removeToken(String consumerKey, String userId);
}
